package com.scuec.groupfive.mapper;

import org.apache.ibatis.annotations.*;

@Mapper
public interface FavoriteMapper {
    @Insert("INSERT INTO favorites (user_id, question_id, status, created_at) " +
            "VALUES (#{userId}, #{questionId}, #{status}, NOW()) " +
            "ON DUPLICATE KEY UPDATE status = #{status}, updated_at = NOW()")
    int upsertFavorite(@Param("userId") Long userId,
                       @Param("questionId") Long questionId,
                       @Param("status") Integer status);
}